import 'package:flutter/material.dart';
import 'package:ytbusiness/page/ad/ad_page.dart';
import 'page/drawer/scanner_login/scanner_result.dart';
import 'page/init_app.dart';
import 'page/auto_makers/perfect_images/add_to_complete.dart';
import 'page/auto_makers/perfect_images/company_real_name.dart';
import 'page/auto_makers/perfect_images/fill_in_manage_info.dart';
import 'page/auto_makers/perfect_images/personal_real_name.dart';
import 'page/auto_makers/perfect_images/repair_manage_info/repair_select_manage.dart';
import 'page/auto_makers/perfect_images/repair_manage_info/select_labor_hour.dart';
import 'page/auto_makers/perfect_images/select_manage_category.dart';
import 'page/auto_makers/shop_home/order_details/already_deliver.dart';
import 'page/auto_makers/shop_home/order_details/auto_await_pay.dart';
import 'page/auto_makers/shop_home/order_details/await_settlement.dart';
import 'page/auto_makers/shop_home/order_details/canceled.dart';
import 'page/auto_makers/shop_home/order_details/have_price.dart';
import 'page/auto_makers/shop_home/order_details/have_settlement.dart';
import 'page/auto_makers/shop_home/order_details/make_ticket.dart';
import 'page/auto_makers/shop_home/order_details/refund.dart';
import 'page/auto_makers/shop_home/order_details/refund_ticket.dart';
import 'page/auto_makers/shop_home/order_details/refunded.dart';
import 'page/auto_makers/shop_home/order_details/waiting_delivery.dart';
import 'page/auto_makers/shop_home/order_details/waiting_offer.dart';
import 'page/drawer/account_settings/account_and_security.dart';
import 'page/drawer/account_settings/account_setting.dart';
import 'page/drawer/account_settings/modify_mailbox.dart';
import 'page/drawer/account_settings/modify_mobile_phone_number.dart';
import 'page/drawer/account_settings/modify_password.dart';
import 'page/drawer/account_settings/modify_success.dart';
import 'page/drawer/account_settings/set_login_password.dart';
import 'page/drawer/scout_drawer_content/insurance_company_info.dart';
import 'page/drawer/scout_drawer_content/scout_login/scout_login.dart';
import 'page/drawer/scout_drawer_content/service_loaction_set.dart';
import 'page/drawer/store/add_invoice.dart';
import 'page/drawer/store/edit_invoice.dart';
import 'page/drawer/store/invoice_management.dart';
import 'page/drawer/store/modify_manage_info.dart';
import 'page/drawer/store/modify_perfect.dart';
import 'page/drawer/store/modify_store.dart';
import 'page/drawer/store/modify_store_manage_info.dart';
import 'page/drawer/store/my_store.dart';
import 'page/message_notice/chat_room/chat_room.dart';
import 'page/message_notice/message_center.dart';
import 'page/order/order_list.dart';
import 'page/password/again_set_Password.dart';
import 'page/password/bank_card_form.dart';
import 'page/password/choice_bank.dart';
import 'page/password/pay_result.dart';
import 'page/password/set_password.dart';
import 'page/repair_factory/accessories_query/accessories_center.dart';
import 'page/repair_factory/accessories_query/accessories_query.dart';
import 'page/repair_factory/accessories_query/repairs_inquiry.dart';
import 'page/repair_factory/accessories_query/select_accessories.dart';
import 'page/repair_factory/accessories_query/select_done.dart';
import 'page/repair_factory/account_management/bill_details.dart';
import 'page/repair_factory/account_management/withdrawal.dart';
import 'page/repair_factory/account_management/top_up.dart';
import 'page/repair_factory/account_management/flow_to_be_settled.dart';
import 'page/repair_factory/account_management/repair_account_management.dart';
import 'page/repair_factory/evaluate/evaluation_success.dart';
import 'page/repair_factory/procurement_order/category_list.dart';
import 'page/repair_factory/procurement_order/procurement_all_order.dart';
import 'page/repair_factory/procurement_order/procurement_already_deliver.dart';
import 'page/repair_factory/procurement_order/procurement_await_deliver.dart';
import 'page/repair_factory/procurement_order/procurement_await_evaluate.dart';
import 'page/repair_factory/procurement_order/procurement_done.dart';
import 'page/repair_factory/repair_factory_home.dart';
import 'page/repair_factory/repair_order/await_balance.dart';
import 'page/repair_factory/repair_order/in_loss_assessment.dart';
import 'page/repair_factory/repair_order/in_maintenance.dart';
import 'page/repair_factory/repair_order/push_repair.dart';
import 'page/repair_factory/repair_order/push_repair_category.dart';
import 'page/repair_factory/repair_order/push_repair_details.dart';
import 'page/repair_factory/repair_order/repair_await_settlement.dart';
import 'page/repair_factory/repair_order/repair_have_settlement.dart';
import 'page/repair_factory/repair_order/repair_refunded.dart';
import 'page/repair_factory/repair_order/repair_with_drawn.dart';
import 'page/repair_factory/repair_order/wait_back_bill.dart';
import 'page/scout/order/already_assessment/scout_already_assessment.dart';
import 'page/scout/order/already_report.dart';
import 'page/scout/order/assessment_dispute.dart';
import 'page/scout/order/assessment_success.dart';
import 'page/scout/order/complete_maintenance.dart';
import 'page/scout/order/quash_case.dart';
import 'page/scout/order/scout_assessment_details/scout_assessment_details.dart';
import 'page/scout/order/scout_assessment_details/select_work_done.dart';
import 'page/scout/order/scout_assessment_details/select_work_time.dart';
import 'page/scout/order/scout_assessment_details/work_time_list.dart';
import 'page/scout/order/scout_await_assessment.dart';
import 'page/scout/order/scout_in_maintenance.dart';
import 'page/scout/order/scout_order_catgory.dart';
import 'page/scout/order/select_repair_factory.dart';
import 'page/scout/scout.dart';
import 'page/select_role/check_role.dart';
import 'page/select_role/one_click_login.dart';
import 'page/select_role/phone_sms_verification.dart';
import 'page/splash/splash.dart';
import 'page/auto_makers/create_shop/create_store.dart';
import 'page/auto_makers/perfect_images/perfect_info.dart';
import 'page/auto_makers/shop_home/order_details/await_ticket.dart';
import 'page/auto_makers/shop_home/order_widget/all_order.dart';
import 'page/auto_makers/shop_home/order_widget/order_page.dart';
import 'page/auto_makers/shop_home/shop_home_page.dart';
import 'page/drawer/scanner_login/scanner.dart';
import 'page/password/add_bank_card.dart';
import 'page/repair_factory/evaluate/goods_evaluate.dart';
import 'page/repair_factory/procurement_order/await_confirm.dart';
import 'page/repair_factory/procurement_order/await_pay.dart';
import 'page/repair_factory/procurement_order/procurement_enquiry.dart';

/// Created by nb on 2020/12/28
///
/// Version 1.0
/// Describe:管理路由
class RouteManager {
  ///
  static final Map<String, Function> routesMap = {
    //初始化app
    initApp: (context) => InitApp(),
    splash: (context) => Splash(),
    adPage: (context) => AdPage(),

    checkRole: (context) => CheckRole(),
    //一键登录
    'one_click_login': (context) => OneClickLogin(),
    //勘察员登录
    scoutLogin: (context) => ScoutLogin(),

    orderList: (context, {Map<String, dynamic> arguments}) =>
        OrderList(arguments: arguments),

    //短信验证码
    'phone_sms_verification': (context) => PhoneSmsVerification(),
    //创建店铺
    'create_store': (context) => CreateStore(),
    //修改店铺信息
    'modify_store': (context) => ModifyStore(),
    //修改店铺实名信息（营业执照）
    'modify_perfect': (context) => ModifyPerfect(),
    //汽配商修改经营信息
    'modify_manage_info': (context) => ModifyManageInfo(),
    //修理厂修改经营模式
    'modify_store_manage_info': (context) => ModifyStoreManageInfo(),
    //完善店铺营业执照
    'wanshanxinxi': (context) => PerfectInfo(),
    //个人实名认证
    'personal_real_name': (context) => PersonalRealName(),
    //企业实名认证
    'company_real_name': (context) => CompanyRealName(),
    //完善经营信息
    'fill_in_manage_info': (context) => FillInManageInfo(),
    //修理厂完善经营信息
    'repair_select_manage': (context) => RepairSelectManage(),
    //选择经营类目
    'select_manage_category': (context, {Map<String, dynamic> arguments}) =>
        SelectManageCategory(arguments: arguments),
    //修理厂选择工时信息
    'select_labor_hour': (context) => SelectLaborHour(),
    //完善信息完成
    'add_to_complete': (context) => AddToComplete(),

    accountSetting: (context) => AccountSetting(),
    //设置密码
    'set_login_password': (context) => SetLoginPassword(),
    //修改密码
    'modify_password': (context) => ModifyPassword(),
    //账号与安全
    'account_and_security': (context) => AccountAndSecurity(),
    //修改手机号
    'modify_mobile_phone_number': (context) => ModifyMobilePhoneNumber(),
    //修改成功
    'modify_success': (context) => ModifySuccess(),
    //修改邮箱
    'modify_mailbox': (context) => ModifyMailbox(),
    //编辑发票
    'edit_invoice': (context) => EditInvoice(),
    //添加发票
    'add_invoice': (context) => AddInvoice(),

    myStore: (context) => MyStore(),
    //发票管理
    'invoice_management': (context) => InvoiceManagement(),
    //汽配商店铺主页
    'store_home_page': (context) => ShopHomePage(),
    //修理厂主页
    'repair_factory_home': (context) => RepairFactoryHome(),

    scoutHome: (context) => Scout(),
    //保司信息
    'insurance_company_info': (context) => InsuranceCompanyInfo(),
    //服务地区设置
    'service_loaction_set': (context) => ServiceLoactionSet(),
    //消息中心
    'message_center': (context) => MessageCenter(),
    //聊天室
    'chat_room': (context, {Map<String, dynamic> arguments}) =>
        ChatRoom(arguments: arguments),
    //汽配商 全部订单
    'all_order': (context) => AllOrder(),
    //汽配商 订单分类
    'order_page': (context, {Map<String, dynamic> arguments}) =>
        OrderPage(arguments: arguments),
    //汽配商 待报价
    'waiting_offer': (context) => WaitingOffer(),
    //汽配商 已报价
    'have_price': (context) => HavePrice(),
    //汽配商 待付款
    'auto_await_pay': (context) => AutoAwaitPay(),
    //汽配商 待发货
    'waiting_delivery': (context) => WaitingDelivery(),
    //汽配商 已发货
    'already_deliver': (context) => AlreadyDeliver(),
    //汽配商 待开票
    'await_ticket': (context) => AwaitTicket(),
    //汽配商 已开票
    'make_ticket': (context) => MakeTicket(),
    //汽配商 待结算
    'await_settlement': (context) => AwaitSettlement(),
    //汽配商 已结算
    'have_settlement': (context) => HaveSettlement(),
    //汽配商 已退票
    'refund_ticket': (context) => RefundTicket(),
    //汽配商 已取消
    'canceled': (context) => Canceled(),
    //汽配商 退款中
    'refund': (context) => Refund(),
    //汽配商 已退款
    'refunded': (context) => Refunded(),
    //修理厂 推修订单列表
    'push_repair': (context) => PushRepair(),
    //修理厂 推修订单分类
    'push_repair_category': (context, {Map<String, dynamic> arguments}) =>
        PushRepairCategory(arguments: arguments),
    //修理厂 新推修
    'push_repair_details': (context, {Map<String, dynamic> arguments}) =>
        PushRepairDetails(arguments: arguments),
    //修理厂 定损中
    'in_loss_assessment': (context, {Map<String, dynamic> arguments}) =>
        InLossAssessment(arguments: arguments),
    //修理厂 维修中
    'in_maintenance': (context, {Map<String, dynamic> arguments}) =>
        InMaintenance(arguments: arguments),
    //修理厂 待开票
    'wait_back_bill': (context, {Map<String, dynamic> arguments}) =>
        WaitBackBill(arguments: arguments),
    //修理厂 已开票
    'repair_await_settlement': (context, {Map<String, dynamic> arguments}) =>
        RepairAwaitSettlement(arguments: arguments),
    //修理厂 已退票
    'repair_refunded': (context, {Map<String, dynamic> arguments}) =>
        RepairRefunded(arguments: arguments),
    //修理厂 待结算
    'await_balance': (context, {Map<String, dynamic> arguments}) =>
        AwaitBalance(arguments: arguments),
    //修理厂 已结算
    'repair_have_settlement': (context, {Map<String, dynamic> arguments}) =>
        RepairHaveSettlement(arguments: arguments),
    //修理厂 已撤案
    'repair_withdrawn': (context, {Map<String, dynamic> arguments}) =>
        RepairWithDrawn(arguments: arguments),
    //账户管理
    'repair_account_management': (context) => RepairAccountManagement(),
    //待结算流水
    'flow_too_be_settled': (context) => FlowTooBeSettled(),
    //账单明细
    'bill_details': (context) => BillDetails(),
    //提现
    'withdrawal': (context) => Withdrawal(),
    //充值
    'top_up': (context) => TopUp(),
    //配件查询
    'accessories_query': (context) => AccessoriesQuery(),
    //配件询价
    'repairs_inquiry': (context) => RepairsInquiry(),
    //配件中心
    'accessories_center': (context) => AccessoriesCenter(),
    //选择配件
    'select_accessories': (context, {Map<String, dynamic> arguments}) =>
        SelectAccessories(arguments: arguments),
    //选择完成
    'select_done': (context, {Map<String, dynamic> arguments}) =>
        SelectDone(arguments: arguments),
    //全部采购订单
    'procurement_all_order': (context) => ProcurementAllOrder(),
    //采购订单分类列表
    'category_list': (context, {Map<String, dynamic> arguments}) =>
        CategoryList(arguments: arguments),
    //询价中
    'procurement_enquiry': (context) => ProcurementEnquiry(),
    //待确认
    'await_confirm': (context) => AwaitConfirm(),
    //待支付
    'await_pay': (context) => AwaitPay(),
    //设置密码
    'set_password': (context) => SetPassword(),
    //再次输入密码
    'again_set_password': (context) => AgainSetPassword(),
    //支付结果
    'pay_result': (context) => PayResult(),
    //添加银行卡
    'add_bank_card': (context) => AddBankCard(),
    //银行卡添加表单
    'bank_card_form': (context) => BankCardForm(),
    //选择银行
    'choice_bank': (context) => ChoiceBank(),
    //修理厂 待收货
    'procurement_await_deliver': (context) => ProcurementAwaitDeliver(),
    //修理厂 已收货
    'procurement_already_deliver': (context) => ProcurementAlreadyDeliver(),
    //修理厂 待评价
    'procurement_await_evaluate': (context) => ProcurementAwaitEvaluate(),
    //修理厂 已完成
    'procurement_done': (context) => ProcurementDone(),
    //修理厂 商品评价
    'goods_evaluate': (context) => GoodsEvaluate(),
    //修理厂 评价成功
    'evaluation_success': (context) => EvaluationSuccess(),
    //勘察员 订单分类列表
    'scout_order_catgory': (context, {Map<String, dynamic> arguments}) =>
        ScoutOrderCategory(arguments: arguments),
    //勘察员 已报案
    'already_report': (context) => AlreadyReport(),
    //选择修理厂
    'select_repair_factory': (context) => SelectRepairFactory(),
    //勘察员 待定损
    'scout_await_assessment': (context) => ScoutAwaitAssessment(),
    //勘察员 定损详情
    'scout_assessment_details': (context) => ScoutAssessmentDetails(),
    //勘察员 已定损
    'scout_already_assessment': (context) => ScoutAlreadyAssessment(),
    //勘察员 定损争议
    'assessment_dispute': (context) => AssessmentDispute(),
    //勘察员 定损成功
    'assessment_success': (context) => AssessmentSuccess(),
    //勘察员 已撤案
    'quash_case': (context) => QuashCase(),
    //勘察员 维修完成
    'complete_maintenance': (context) => CompleteMaintenance(),
    //勘察员 维修中
    'scout_in_maintenance': (context) => ScoutInMaintenance(),
    //选择工时 分类
    'select_work_time': (context) => SelectWorkTime(),
    //工时 列表
    'work_time_list': (context, {Map<String, dynamic> arguments}) =>
        WorkTimeList(arguments: arguments),
    //工时 选择完成
    'select_work_done': (context) => SelectWorkDone(),

    scanner: (context) => Scanner(),
    scannerResult: (context, {Map<String, dynamic> arguments}) =>
        ScannerResult(arguments: arguments),
  };

  ///返回路由
  static RouteFactory onGenerateRoute = (RouteSettings settings) {
    Function pageContentBuilder = routesMap[settings.name];
    print("路由---------------->${settings.name}");

    if (pageContentBuilder == null) return null;

    if (settings.arguments != null) {
      print("参数---------------->${settings.arguments}");

      return MaterialPageRoute(
          builder: (context) =>
              pageContentBuilder(context, arguments: settings.arguments)
                  as Widget);
    } else {
      return MaterialPageRoute(
          builder: (context) => pageContentBuilder(context) as Widget);
    }
  };

  ///默认前缀
  static const String _defaultPre = "yuntu://";

  ///初始化页面
  static const String initApp = "init_app";

  ///引导页
  static const String splash = "splash";

  ///广告页
  static const String adPage = "ad_page";

  ///扫描二维码登录
  static const String scanner = "scanner";

  ///扫描二维码登录 结果页面
  static const String scannerResult = "scanner_result";

  ///我的店铺
  static const String myStore = "my_store";

  ///账号设置
  static const String accountSetting = "account_setting";

  ///切換角色
  static const String checkRole = "check_role";

  ///登录
  static const String scoutLogin = "scout_login";

  ///订单列表页面
  static const String orderList = "order_list";

  ///勘察员主页
  static const String scoutHome = "scout";

  ///路由方法
  static String route(String name, {String pre = _defaultPre}) {
    return pre + name;
  }
}
